home *** CD-ROM | disk | FTP | other *** search
/ Computer Arts: Pro Software Skills - Photoshop / Computer Arts Pro Software Skills Photoshop.iso / pc / main.swf / scripts / frame_5 / DoAction.as < prev   
Encoding:
Text File  |  2011-06-06  |  8.8 KB  |  394 lines

  1. function setActiveItem(mc)
  2. {
  3.    activeSection = mc;
  4.    sectionTitle = mc.secName;
  5. }
  6. function unClickActiveItems()
  7. {
  8.    if(activeSection)
  9.    {
  10.       i = 0;
  11.       while(i < activeSection.pItems.length)
  12.       {
  13.          activeSection.pItems[i].gotoAndStop(1);
  14.          i++;
  15.       }
  16.    }
  17. }
  18. function closeLargeImageViewer()
  19. {
  20.    setMenuVisible(true);
  21.    largeImageLoader._visible = false;
  22. }
  23. function showNextLargeImage()
  24. {
  25.    largeImageLoader.nextImage();
  26. }
  27. function showPreviousLargeImage()
  28. {
  29.    largeImageLoader.previousImage();
  30. }
  31. function itemObject(pName, pPath)
  32. {
  33.    iObj = new Object();
  34.    iObj.pName = pName.slice(0,-1);
  35.    iObj.pPath = pPath.slice(0,-2);
  36.    return iObj;
  37. }
  38. function sectionObject(pName, pPath)
  39. {
  40.    sObj = new Object();
  41.    sObj.pName = pName.slice(0,-1);
  42.    sObj.pPath = pPath.indexOf("\n") == -1 ? pPath : pPath.slice(0,-2);
  43.    sObj.pItems = new Array();
  44.    return sObj;
  45. }
  46. function makeMenus(lst)
  47. {
  48.    tmp = lst.split("---");
  49.    tmp.shift();
  50.    ln = 0;
  51.    while(ln < tmp.length)
  52.    {
  53.       it = tmp[ln].split("-");
  54.       section = it[0].split("@");
  55.       menuObject.push(sectionObject(section[0],section[1]));
  56.       currentObj = menuObject[ln];
  57.       sub = 1;
  58.       while(sub < it.length)
  59.       {
  60.          item = it[sub].split("@");
  61.          obj = itemObject(item[0],item[1]);
  62.          currentObj.pItems.push(obj);
  63.          sub++;
  64.       }
  65.       ln++;
  66.    }
  67.    xPos = 323;
  68.    itemCount = 0;
  69.    sec = 0;
  70.    while(sec < menuObject.length)
  71.    {
  72.       ixPos = 350;
  73.       iyPos = 210;
  74.       pSec = menuObject[sec];
  75.       duplicateMovieClip(secObj,"secObj" + sec,16384 + this.getNextHighestDepth());
  76.       mc = _root["secObj" + sec];
  77.       menuMcs.push(mc);
  78.       mc.secName = pSec.pName;
  79.       mc.secPath = pSec.pPath;
  80.       mc.pItems = new Array();
  81.       itemsArray = new Array();
  82.       i = 0;
  83.       while(i < pSec.pItems.length)
  84.       {
  85.          trace(pSec.pItems[i].pName);
  86.          duplicateMovieClip(itemObj,"itemObj" + itemCount,16384 + this.getNextHighestDepth());
  87.          imc = _root["itemObj" + itemCount];
  88.          imc.iName = pSec.pItems[i].pName;
  89.          imc.pPath = pSec.pItems[i].pPath;
  90.          imc.secPath = pSec.pPath;
  91.          imc._x = ixPos;
  92.          imc._y = iyPos;
  93.          imc._visible = false;
  94.          mc.pItems.push(imc);
  95.          if(i == 2 || i == 5 || i == 8 || i == 11 || i == 14)
  96.          {
  97.             ixPos = 350;
  98.             iyPos += 12;
  99.          }
  100.          else
  101.          {
  102.             ixPos += 170;
  103.          }
  104.          itemCount += 1;
  105.          i++;
  106.       }
  107.       mc._x = xPos;
  108.       mc._y = 180;
  109.       xPos += 170;
  110.       sec++;
  111.    }
  112. }
  113. function loadPictures(path, imgList)
  114. {
  115.    imgs = Array();
  116.    i = 0;
  117.    while(i < imgList.length)
  118.    {
  119.       imgs.push(path + _global.delim + imgList[i]);
  120.       i++;
  121.    }
  122.    imgLoader.setImageList(imgs);
  123.    if(imgs[0].indexOf("shot") == -1)
  124.    {
  125.       imgLoader.imageZoomButton._visible = true;
  126.    }
  127.    else
  128.    {
  129.       imgLoader.imageZoomButton._visible = false;
  130.    }
  131.    videoWindow._visible = false;
  132.    imgLoader._visible = true;
  133. }
  134. function setPictureNumber(num)
  135. {
  136.    imgLoader.setImageButtonClicked(num);
  137.    imgLoader.loadImage(num);
  138. }
  139. function showLargeImageViewer()
  140. {
  141.    setMenuVisible(false);
  142.    largeImageLoader.setImageList(imgLoader.getImageList());
  143.    largeImageLoader.loadLargeImage(imgLoader.getSelectedImageNumber());
  144.    largeImageLoader._visible = true;
  145. }
  146. function loadVideo(resources, num)
  147. {
  148.    videoWindow._visible = true;
  149.    vPath = resolveVideoURL(currentVideoPath + _global.delim + resources[num]);
  150.    trace("LOADING VIDEO: " + vPath);
  151.    videoWindow.setContentPath(vPath);
  152.    imgLoader._visible = false;
  153. }
  154. function setVideoPath(path)
  155. {
  156.    currentVideoPath = path;
  157. }
  158. function setVideoResourcesList(lst)
  159. {
  160.    trace(lst);
  161.    videoResourceList = lst;
  162.    pNum = lst.length;
  163.    videoWindow.setVideoLabels(pNum);
  164. }
  165. function setMenuVisible(bool)
  166. {
  167.    if(bool)
  168.    {
  169.       mc = 0;
  170.       while(mc < menuMcs.length)
  171.       {
  172.          menuMcs[mc]._visible = true;
  173.          mc++;
  174.       }
  175.       m = 0;
  176.       while(m < activeSection.pItems.length)
  177.       {
  178.          activeSection.pItems[m]._visible = true;
  179.          m++;
  180.       }
  181.    }
  182.    else
  183.    {
  184.       mc = 0;
  185.       while(mc < menuMcs.length)
  186.       {
  187.          menuMcs[mc]._visible = false;
  188.          imc = 0;
  189.          while(imc < menuMcs[mc].pItems.length)
  190.          {
  191.             menuMcs[mc].pItems[imc]._visible = false;
  192.             imc++;
  193.          }
  194.          mc++;
  195.       }
  196.    }
  197. }
  198. function setInfoText(txt)
  199. {
  200.    if(txt != undefined)
  201.    {
  202.       mainTextBox.htmlText = txt;
  203.    }
  204. }
  205. function loadInfoText(path)
  206. {
  207.    infoLoader.load(path + _global.delim + "info.txt");
  208. }
  209. function setMainTitle(txt)
  210. {
  211.    infoTitle = txt;
  212. }
  213. function unClickMenus()
  214. {
  215.    infoTitle = "";
  216.    infoText = "";
  217.    sec = 0;
  218.    while(sec < menuObject.length)
  219.    {
  220.       _root["secObj" + sec].gotoAndStop(1);
  221.       _root["secObj" + sec].hideItems();
  222.       sec++;
  223.    }
  224. }
  225. function stopVideo()
  226. {
  227.    if(flvPlaying)
  228.    {
  229.       this.videoWindow.myVideoPlayer.pause();
  230.    }
  231. }
  232. function getFixedPath(path)
  233. {
  234.    if(_level0._url == "" || _level0._url == undefined)
  235.    {
  236.       fixedPath = path;
  237.    }
  238.    else
  239.    {
  240.       fixedPath = _level0._url + _global.delim + path;
  241.    }
  242.    return fixedPath;
  243. }
  244. function setOpenFolder(path, platformNumber)
  245. {
  246.    trace("Setting Open Folder " + path + " " + platformNumber);
  247.    pathTest = path;
  248.    plat = System.capabilities.os;
  249.    if(plat.toLowerCase().indexOf("win") != -1)
  250.    {
  251.       xPath = path;
  252.       openFolderButton.setPath(xPath);
  253.       openFolderButton._visible = true;
  254.       rootOpenFolderPath = xPath;
  255.    }
  256.    else
  257.    {
  258.       openFolderButton._visible = false;
  259.       openFolderMacPathIndicator.pathText = path;
  260.       openFolderMacPathIndicator._visible = true;
  261.    }
  262.    imgLoader._visible = true;
  263.    videoWindow._visible = false;
  264. }
  265. function zoomVideoPlayer()
  266. {
  267.    flvPlaying = false;
  268.    if(videoZoomed)
  269.    {
  270.       setMenuVisible(true);
  271.       videoWindow.gotoAndStop(1);
  272.       setVideoItem(0);
  273.       videoWindow.myVideoPlayer.play();
  274.    }
  275.    else
  276.    {
  277.       trace("Big Video Player");
  278.       setMenuVisible(false);
  279.       cPath = videoWindow.myVideoPlayer.contentPath;
  280.       videoWindow.gotoAndStop(2);
  281.       trace(videoWindow.bigVideoPlayer._x);
  282.       setVideoItem(0);
  283.       trace(videoWindow.bigVideoPlayer.contentPath);
  284.       videoWindow.bigVideoPlayer.play();
  285.    }
  286.    videoZoomed = !videoZoomed;
  287. }
  288. function toggleVideoSelector()
  289. {
  290.    if(selectorVisible)
  291.    {
  292.       videoWindow.videoSelector._visible = false;
  293.       selectorVisible = false;
  294.    }
  295.    else
  296.    {
  297.       videoWindow.videoSelector._visible = true;
  298.       selectorVisible = true;
  299.    }
  300. }
  301. function setVideoItem(num)
  302. {
  303.    trace("SET VIDEO ITEM");
  304.    loadVideo(videoResourceList,num);
  305.    trace("VIDEO ITEM TO BE LOADED=" + videoResourceList[num]);
  306.    videoWindow.videoSelector._visible = false;
  307.    selectorVisible = false;
  308. }
  309. function resolveVideoURL(url)
  310. {
  311.    var _loc11_ = System.capabilities.os;
  312.    if(_loc11_ != "MacOS")
  313.    {
  314.       return url;
  315.    }
  316.    var _loc5_ = _level0._url;
  317.    var _loc9_ = _loc5_.substr(0,4);
  318.    if(_loc9_ == "http")
  319.    {
  320.       return url;
  321.    }
  322.    var _loc10_ = _loc5_.indexOf("/Volumes/");
  323.    if(_loc10_ == -1)
  324.    {
  325.       return url;
  326.    }
  327.    var _loc7_ = String("file:///Volumes/").length;
  328.    var _loc12_ = _loc5_.substring(_loc7_);
  329.    var _loc3_ = _loc12_.split("/");
  330.    _loc3_.splice(_loc3_.length - 1,1);
  331.    var _loc4_ = url.split("/");
  332.    var _loc1_ = 0;
  333.    while(_loc1_ < _loc4_.length)
  334.    {
  335.       var _loc2_ = _loc4_[_loc1_];
  336.       if(_loc2_ == "..")
  337.       {
  338.          _loc3_.splice(_loc3_.length - 1,1);
  339.       }
  340.       else
  341.       {
  342.          _loc3_.push(_loc2_);
  343.       }
  344.       _loc1_ = _loc1_ + 1;
  345.    }
  346.    var _loc8_ = _loc3_.join(":");
  347.    return _loc8_;
  348. }
  349. var os = System.capabilities.os;
  350. trace(ostype);
  351. _global.delim = "";
  352. if(ostype.indexOf("Mac") == -1)
  353. {
  354.    _global.delim = "\\";
  355. }
  356. else
  357. {
  358.    _global.delim = "/";
  359. }
  360. var videoZoomed = false;
  361. var vidPath = "";
  362. var currentVideoPath = "";
  363. var videoResourceList = new Array();
  364. var menuMcs = new Array();
  365. var videoInitialised = false;
  366. var activeSection;
  367. var rootOpenFolderPath;
  368. myAppPath = mdm.Application.path;
  369. if(myAppPath == undefined)
  370. {
  371.    myAppPath = "";
  372. }
  373. var menuObject = new Array();
  374. menusPath = mdm.Application.path + "menus" + _global.delim + "menu_items.txt";
  375. var st = "dsfd!";
  376. var activeSection = 0;
  377. var flvPlaying = false;
  378. videoWindow._visible = false;
  379. appPath = menusPath;
  380. var lv = new LoadVars();
  381. lv.onData = function(dat)
  382. {
  383.    appPath = dat;
  384.    makeMenus(dat);
  385.    trace(menuObject);
  386. };
  387. lv.load(menusPath);
  388. var infoLoader = new LoadVars();
  389. infoLoader.onData = function(txt)
  390. {
  391.    setInfoText(txt);
  392. };
  393. var selectorVisible = false;
  394.